package com.xmyr.cachedemo.controller;

import com.xmyr.cachedemo.pojo.DemoModel;
import com.xmyr.cachedemo.sevice.IDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author CCQ(QQ or weChat : 1330845068 ( 寻梦依然))
 * @version 1.0
 * @date 2022/3/27 12:08
 */
@RestController
@RequestMapping("demo")
public class DemoController {
    @Autowired
    private IDemoService demoService;


    @RequestMapping("getById/{id}")
    DemoModel getById(@PathVariable Long id){
        return demoService.getById(id);
    }

    @RequestMapping("save")
    Boolean save(DemoModel model){
        return demoService.save(model);
    }

    @RequestMapping("updateById/{id}/{username}")
    DemoModel updateById(@PathVariable Long id, @PathVariable String username){
        return demoService.updateById(id,username);
    }

    @RequestMapping("deleteById/{id}")
    Boolean deleteById(@PathVariable Long id){
        return demoService.deleteById(id);
    }
}
